"""线索页面"""
from page.base_page import BasePage
from selenium.webdriver.common.by import By


class CluePage(BasePage):
    url = '/crm5/index.php?m=leads'
    #定位器
    btn_new_clue_locator = (By.CSS_SELECTOR, 'body > div.container > div.row > div:nth-child(1) > div > a')
    success_tips_locator = (By.CSS_SELECTOR, 'body > div.container > div.alert.alert-success')
    view_locator = (By.CSS_SELECTOR, '#form1 > table > tbody > tr:nth-child(1) > td:nth-child(12) > a:nth-child(1)')


    def click_btn_new_clue(self):
        """点击新建线索"""
        self.driver.find_element(*self.btn_new_clue_locator).click()

    def click_view(self):
        """点击查看"""
        self.driver.find_element(*self.view_locator).click()
        
    def success_tips_text(self):
        """获取提示信息元素的内容"""
        return self.driver.find_element(*self.success_tips_locator).text
